﻿using System.Xml.Linq;
using Engine;
using Game;


public class CreatureBagWidget : CanvasWidget
{
    public ComponentCreature m_componentCreature;

    public GridPanelWidget m_BagGrid;
    public GridPanelWidget m_BagGrid2;

    public CreatureBagWidget(ComponentCreature componentCreature)
    {
        m_componentCreature = componentCreature;
        XElement node = ContentManager.Get<XElement>("Widgets/swbb");
        LoadContents(this, node);
        m_BagGrid = Children.Find<GridPanelWidget>("BagGrid");
        m_BagGrid2 = Children.Find<GridPanelWidget>("BagGrid2");
        int num = 0;
        for (int j = 0; j < m_BagGrid2.RowsCount; j++)
        {
            for (int k = 0; k < m_BagGrid2.ColumnsCount; k++)
            {
                var inventorySlotWidget77 = new InventorySlotWidget();
                inventorySlotWidget77.AssignInventorySlot(m_componentCreature.Entity.FindComponent<ComponentInventoryBase>(), num++);
                m_BagGrid2.Children.Add(inventorySlotWidget77);
                m_BagGrid2.SetWidgetCell(inventorySlotWidget77, new Point2(k, j));
            }
        }
        num = 10;
        for (int j = 0; j < m_BagGrid.RowsCount; j++)
        {
            for (int k = 0; k < m_BagGrid.ColumnsCount; k++)
            {
                var inventorySlotWidget66 = new InventorySlotWidget();
                inventorySlotWidget66.AssignInventorySlot(m_componentCreature.Entity.FindComponent<ComponentInventoryBase>(), num++);
                m_BagGrid.Children.Add(inventorySlotWidget66);
                m_BagGrid.SetWidgetCell(inventorySlotWidget66, new Point2(k, j));
            }
        }
    }

    public override void Update()
    {
    }
}
